#include "contacts.pb.h"

int main()
{
    contacts::contacts con;
    con.set_stuid(1001);
    con.set_name("小帅");
    con.set_score(98.5);

    std::string str = con.SerializeAsString();  // 序列化

    contacts::contacts stu;
    bool ret = stu.ParseFromString(str);
    if(!ret) 
    {
        std::cout << "反序列化失败！\n";
        return -1;
    }
    std::cout << stu.stuid() << "\n";
    std::cout << stu.name() << "\n";
    std::cout << stu.score() << "\n";
    return 0;
}